package com.ltt.controller;

import com.ltt.annotation.NoAuth;
import com.ltt.config.WebSocketServer;
import com.ltt.dao.vo.Result;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @author ‘李天泰’
 * @version 1.0
 * @description: TODO
 * @date 2023/5/18 8:39
 */
@RestController
public class WebSocketController {

    @NoAuth
    @RequestMapping("/push/{toUserId}")
    public Result pushToWeb(String message, @PathVariable String toUserId) throws IOException {
        WebSocketServer.sendInfo(message, toUserId);
        return Result.successWithoutData();
    }
}
